﻿@using Sausage.Web.Domain
@using Sausage.Web.DataModel
@using Sausage.Common
@model Sausage.Web.DataModel.Project
@{
    ViewBag.Title = string.Format("工程详细信息（{0}）", Model.ProjectName);
    Layout = "~/Views/Shared/MainLayout.cshtml";
}
<h2>
    @ViewBag.Title
</h2>
<br />
<div class="form-box">
    <table class="TableDetail">
        <tr>
            <th>
                所属单位
            </th>
            <td>
                @Html.DisplayFor(model => model.Organization.OrganizationName)
            </td>
        </tr>
        <tr>
            <th>
                项目编号
            </th>
            <td>
                @Html.DisplayFor(model => model.ProjectCode)
            </td>
        </tr>
        <tr>
            <th>
                项目名称
            </th>
            <td>
                @Html.DisplayFor(model => model.ProjectName)
            </td>
        </tr>
        <tr>
            <th>
                项目类型
            </th>
            <td>
                @Html.DisplayFor(model => model.ProjectCategory.ItemName)
            </td>
        </tr>
        <tr>
            <th>
                线路名称
            </th>
            <td>
                @Html.DisplayFor(model => model.Roadway)
            </td>
        </tr>
        <tr>
            <th>
                起点桩号
            </th>
            <td>
                @Html.DisplayFor(model => model.BeginStake)
            </td>
        </tr>
        <tr>
            <th>
                终止桩号
            </th>
            <td>
                @Html.DisplayFor(model => model.EndStake)
            </td>
        </tr>
        <tr>
            <th>
                项目批号
            </th>
            <td>
                @Html.DisplayFor(model => model.GrantNumber)
            </td>
        </tr>
        <tr>
            <th>
                开工日期
            </th>
            <td>
                @string.Format("{0}", Model.StartDate.HasValue ? Model.StartDate.Value.ToString("yyyy年MM月dd日") : "/")
            </td>
        </tr>
        <tr>
            <th>
                竣工日期
            </th>
            <td>
                @string.Format("{0}", Model.CompletionDate.HasValue ? Model.CompletionDate.Value.ToString("yyyy年MM月dd日") : "/")
            </td>
        </tr>
        <tr>
            <th>
                项目负责
            </th>
            <td>
                @Html.DisplayFor(model => model.ProjectLeader)
            </td>
        </tr>
        <tr>
            <th>
                技术负责
            </th>
            <td>
                @Html.DisplayFor(model => model.TechnicalChief)
            </td>
        </tr>
        <tr>
            <th>
                质检负责
            </th>
            <td>
                @Html.DisplayFor(model => model.QualityChief)
            </td>
        </tr>
        <tr>
            <th>
                建安预算
            </th>
            <td>
                @string.Format("{0} 万元", Model.Budget.HasValue ? Model.Budget.Value.ToString("#,##0.00") : "/")
            </td>
        </tr>
        <tr>
            <th>
                建安批复
            </th>
            <td>
                @string.Format("{0} 万元", Model.ApprovedBudget.HasValue ? Model.ApprovedBudget.Value.ToString("#,##0.00") : "/")
            </td>
        </tr>
        <tr>
            <th>
                项目状态
            </th>
            <td>
                @Html.Raw(ProjectStateEnumFormatter.Format((ProjectStateEnum)Model.State))
            </td>
        </tr>
        <tr>
            <th>
                创建日期
            </th>
            <td>
                @string.Format("{0:yyyy年MM月dd日}", Model.CreateDate)
            </td>
        </tr>
        <tr>
            <th>
                关闭日期
            </th>
            <td>
                @string.Format("{0:yyyy年MM月dd日}", Model.CloseDate)
            </td>
        </tr>
        <tr>
            <th>
                项目附件
            </th>
            <td>
                <ul class="AttachmentList">
                    @{
                        //查询允许的组织结构
                        List<Guid> organizations = OrganizationHelper.GetAllowedOrganizationList();

                        //循环输出附件信息
                        foreach (ProjectAttachment attachment in Model.ProjectAttachment.Where(item => item.IsOpen || organizations.Contains(item.OrganizationID)))
                        {
                        @Html.Raw("<li>");
                        @Html.ActionLink(attachment.AttachmentName, "DownloadAttachment", new { attachmentID = attachment.AttachmentID }, new { @target = "_blank" })
                        @Html.Raw("</li>");
                        }   
                    }
                </ul>
            </td>
        </tr>
        <tr>
            <th>
                相关内容
            </th>
            <td>
                <ul class="QuickList">
                    <li>@Html.ActionLink("工程量", "ViewtProjectQuantity", "ProjectQuantity", new { projectID = @Model.ProjectID }, new { @target = "_blank" })</li>
                    <li>@Html.ActionLink("工程日志", "ViewProjectJournal", "ProjectJournal", new { projectID = @Model.ProjectID }, new { @target = "_blank" })</li>
                    <li>@Html.ActionLink("工程人工", "ViewProjectLabour", "ProjectLabour", new { projectID = @Model.ProjectID }, new { @target = "_blank" })</li>
                    <li>@Html.ActionLink("工程材料", "ViewProjectMaterial", "ProjectMaterial", new { projectID = @Model.ProjectID }, new { @target = "_blank" })</li>
                    <li>@Html.ActionLink("工程机械", "ViewProjectMachine", "ProjectMachine", new { projectID = @Model.ProjectID }, new { @target = "_blank" })</li>
                    @{
                        //判断是否有工程计划
                        if (ProjectPlanHelper.GetProjectPlanByProjectID(Model.ProjectID) != null)
                        {
                        @Html.Raw("<li>");
                        @Html.ActionLink("工程计划", "ViewProjectPlan", "ProjectPlan", new { projectID = Model.ProjectID }, new { @target = "_blank" })
                        @Html.Raw("</li>");
                        }
                    }
                </ul>
            </td>
        </tr>
    </table>
</div>
<br />
